package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Autowired
    private IFollowService followService;

    @GetMapping("or/not/{id}")
    public Result followOrNot(@PathVariable("id") Long followUserId){
        return followService.followOrNot(followUserId);
    }

    @PutMapping("/{followUserId}/{isSubscribe}")
    public Result changeSubscribe(@PathVariable("followUserId") Long followUserId,
                                  @PathVariable("isSubscribe") Boolean isSubscribe){
        return followService.changeSubscribe(followUserId, isSubscribe);
    }

    @GetMapping("/common/{userId}")
    public Result commonSubscribe(@PathVariable("userId") Long userId){
        return followService.commonSubscribe(userId);
    }
}
